<form class="form-horizontal" role="form" method="post" action="<?=site_url('importw/add/'.$storage_id) ?>">  
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label"></label>    
    <div class="col-sm-10">
      Kho <?=$storage->title ?> <span class="badge"><?=$storage->left_quantity ?></span>
      <!-- <a href="<?=site_url('importw/info/'.$storage_id); ?>" class="btn btn-primary" role="button">Xem thông tin kho</a> -->
    </div>
  </div>  
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Nhập code</label>
    <div class="col-sm-10">
      <input id="codeInput" type="text" name="code" class="form-control" placeholder="Nhập code sau đó nhấn Enter" name="color" value="" onchange="luuKho(<?=$storage->left_quantity ?>)" autofocus>
    </div>
  </div>       
</form>

<?php if(!empty($dataImport)): ?>
<div class="table-responsive">
<table id="thong_tin_kho" class="table">
    <thead>
      <tr>
        <td>Sản phẩm</td> 
        <td>Mã sản phẩm</td>
        <td>Màu</td>
        <td>Size</td>
        <td>Ngày</td>
        <td>Xóa</td>
      </tr>
    </thead>
    <tbody>
    <script type="text/javascript">
      var wasSubmitted = false;    
        function checkBeforeSubmit(){
          if(!wasSubmitted) {
            wasSubmitted = true;
            return wasSubmitted;
          }
          return false;
        }    
    </script>
    <?php 
      $i = 1;
      if(isset($dataImport) && !empty($dataImport)):
      foreach($dataImport as $dataRow): 
    ?>      
    <form id="form<?=$i ?>" action="<?=site_url('importw/remove/'.$storage_id.'/'.$dataRow['code'].'/'.$dataRow['storage_product_id']); ?>" onsubmit="return checkBeforeSubmit()">      
      <tr>
        <td><?=$dataRow['product'] ?></td>        
        <td><?=$dataRow['code'] ?></td>
        <td><?=$dataRow['color'] ?></td>
        <td><?=$dataRow['size'] ?></td>
        <td><?=$dataRow['created_date'] ?></td>
        <td><button type="submit" class="btn btn-success">Xoá</button> </td>
      </tr>
    </form>
    <?php 
      $i++;
      endforeach; 
      endif;
    ?>
    </tbody>
</table>
</div>
<?php endif; ?>